.class Lcom/qiniu/resumableio/ResumableIO$3;
.super Lcom/qiniu/auth/JSONObjectRet;
.source "ResumableIO.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/qiniu/resumableio/ResumableIO;->put(Ljava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/auth/JSONObjectRet;)I
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field retryTime:I

.field final synthetic this$0:Lcom/qiniu/resumableio/ResumableIO;

.field final synthetic val$blkCount:I

.field final synthetic val$cancelers:[[Lcom/qiniu/utils/ICancel;

.field final synthetic val$extra:Lcom/qiniu/resumableio/PutExtra;

.field final synthetic val$failure:[Z

.field final synthetic val$input:Lcom/qiniu/utils/InputStreamAt;

.field final synthetic val$key:Ljava/lang/String;

.field final synthetic val$ret:Lcom/qiniu/auth/JSONObjectRet;

.field final synthetic val$startPos:J

.field final synthetic val$success:[I

.field final synthetic val$taskId:I

.field final synthetic val$uploaded:[J


# direct methods
.method constructor <init>(Lcom/qiniu/resumableio/ResumableIO;ILcom/qiniu/resumableio/PutExtra;ILjava/lang/String;Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/auth/JSONObjectRet;[Z[II[J[[Lcom/qiniu/utils/ICancel;J)V
    .registers 16
    .param p1, "this$0"    # Lcom/qiniu/resumableio/ResumableIO;
    .param p2, "idx"    # I

    .prologue
    .line 96
    iput-object p1, p0, Lcom/qiniu/resumableio/ResumableIO$3;->this$0:Lcom/qiniu/resumableio/ResumableIO;

    iput-object p3, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$extra:Lcom/qiniu/resumableio/PutExtra;

    iput p4, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$taskId:I

    iput-object p5, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$key:Ljava/lang/String;

    iput-object p6, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$input:Lcom/qiniu/utils/InputStreamAt;

    iput-object p7, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$ret:Lcom/qiniu/auth/JSONObjectRet;

    iput-object p8, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$failure:[Z

    iput-object p9, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$success:[I

    iput p10, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$blkCount:I

    iput-object p11, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$uploaded:[J

    iput-object p12, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$cancelers:[[Lcom/qiniu/utils/ICancel;

    iput-wide p13, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$startPos:J

    invoke-direct {p0, p2}, Lcom/qiniu/auth/JSONObjectRet;-><init>(I)V

    .line 97
    const/4 v0, 0x5

    iput v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->retryTime:I

    return-void
.end method

.method private onAllSuccess()V
    .registers 10

    .prologue
    .line 100
    const-string v6, ""

    .line 101
    .local v6, "ctx":Ljava/lang/String;
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$extra:Lcom/qiniu/resumableio/PutExtra;

    iget-object v1, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    array-length v2, v1

    const/4 v0, 0x0

    :goto_8
    if-ge v0, v2, :cond_28

    aget-object v8, v1, v0

    .local v8, "ret":Lcom/qiniu/resumableio/PutRet;
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v3, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    const-string v4, ","

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    iget-object v4, v8, Lcom/qiniu/resumableio/PutRet;->ctx:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    add-int/lit8 v0, v0, 0x1

    goto :goto_8

    .line 102
    .end local v8    # "ret":Lcom/qiniu/resumableio/PutRet;
    :cond_28
    invoke-virtual {v6}, Ljava/lang/String;->length()I

    move-result v0

    if-lez v0, :cond_33

    const/4 v0, 0x1

    invoke-virtual {v6, v0}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v6

    .line 103
    :cond_33
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->this$0:Lcom/qiniu/resumableio/ResumableIO;

    iget v1, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$taskId:I

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    # invokes: Lcom/qiniu/resumableio/ResumableIO;->removeTask(Ljava/lang/Integer;)V
    invoke-static {v0, v1}, Lcom/qiniu/resumableio/ResumableIO;->access$000(Lcom/qiniu/resumableio/ResumableIO;Ljava/lang/Integer;)V

    .line 104
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->this$0:Lcom/qiniu/resumableio/ResumableIO;

    iget-object v0, v0, Lcom/qiniu/resumableio/ResumableIO;->mClient:Lcom/qiniu/resumableio/ResumableClient;

    iget-object v1, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$key:Ljava/lang/String;

    iget-object v2, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$input:Lcom/qiniu/utils/InputStreamAt;

    invoke-virtual {v2}, Lcom/qiniu/utils/InputStreamAt;->length()J

    move-result-wide v2

    iget-object v4, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$extra:Lcom/qiniu/resumableio/PutExtra;

    iget-object v4, v4, Lcom/qiniu/resumableio/PutExtra;->mimeType:Ljava/lang/String;

    iget-object v5, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$extra:Lcom/qiniu/resumableio/PutExtra;

    iget-object v5, v5, Lcom/qiniu/resumableio/PutExtra;->params:Ljava/util/Map;

    iget-object v7, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$ret:Lcom/qiniu/auth/JSONObjectRet;

    invoke-virtual/range {v0 .. v7}, Lcom/qiniu/resumableio/ResumableClient;->mkfile(Ljava/lang/String;JLjava/lang/String;Ljava/util/Map;Ljava/lang/String;Lcom/qiniu/auth/CallRet;)Lcom/qiniu/utils/ICancel;

    .line 105
    return-void
.end method


# virtual methods
.method public onFailure(Ljava/lang/Exception;)V
    .registers 11
    .param p1, "ex"    # Ljava/lang/Exception;

    .prologue
    .line 124
    iget v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->retryTime:I

    add-int/lit8 v0, v0, -0x1

    iput v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->retryTime:I

    if-lez v0, :cond_1a

    invoke-virtual {p1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_31

    invoke-virtual {p1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v0

    const-string v1, "Unauthorized"

    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_31

    .line 125
    :cond_1a
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->this$0:Lcom/qiniu/resumableio/ResumableIO;

    iget v1, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$taskId:I

    invoke-static {v1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v1

    # invokes: Lcom/qiniu/resumableio/ResumableIO;->removeTask(Ljava/lang/Integer;)V
    invoke-static {v0, v1}, Lcom/qiniu/resumableio/ResumableIO;->access$000(Lcom/qiniu/resumableio/ResumableIO;Ljava/lang/Integer;)V

    .line 126
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$failure:[Z

    const/4 v1, 0x0

    const/4 v2, 0x1

    aput-boolean v2, v0, v1

    .line 127
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$ret:Lcom/qiniu/auth/JSONObjectRet;

    invoke-virtual {v0, p1}, Lcom/qiniu/auth/JSONObjectRet;->onFailure(Ljava/lang/Exception;)V

    .line 135
    :goto_30
    return-void

    .line 130
    :cond_31
    invoke-virtual {p1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_58

    invoke-virtual {p1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v0

    const-string v1, "invalid BlockCtx"

    invoke-virtual {v0, v1}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_58

    .line 131
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$uploaded:[J

    iget v1, p0, Lcom/qiniu/resumableio/ResumableIO$3;->mIdx:I

    const-wide/16 v2, 0x0

    aput-wide v2, v0, v1

    .line 132
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$extra:Lcom/qiniu/resumableio/PutExtra;

    iget-object v0, v0, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    iget v1, p0, Lcom/qiniu/resumableio/ResumableIO$3;->mIdx:I

    new-instance v2, Lcom/qiniu/resumableio/PutRet;

    invoke-direct {v2}, Lcom/qiniu/resumableio/PutRet;-><init>()V

    aput-object v2, v0, v1

    .line 134
    :cond_58
    iget-object v7, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$cancelers:[[Lcom/qiniu/utils/ICancel;

    iget v8, p0, Lcom/qiniu/resumableio/ResumableIO$3;->mIdx:I

    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->this$0:Lcom/qiniu/resumableio/ResumableIO;

    iget-object v0, v0, Lcom/qiniu/resumableio/ResumableIO;->mClient:Lcom/qiniu/resumableio/ResumableClient;

    iget-object v1, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$input:Lcom/qiniu/utils/InputStreamAt;

    iget-object v2, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$extra:Lcom/qiniu/resumableio/PutExtra;

    iget-object v3, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$extra:Lcom/qiniu/resumableio/PutExtra;

    iget-object v3, v3, Lcom/qiniu/resumableio/PutExtra;->processes:[Lcom/qiniu/resumableio/PutRet;

    iget v4, p0, Lcom/qiniu/resumableio/ResumableIO$3;->mIdx:I

    aget-object v3, v3, v4

    iget-wide v4, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$startPos:J

    move-object v6, p0

    invoke-virtual/range {v0 .. v6}, Lcom/qiniu/resumableio/ResumableClient;->putblock(Lcom/qiniu/utils/InputStreamAt;Lcom/qiniu/resumableio/PutExtra;Lcom/qiniu/resumableio/PutRet;JLcom/qiniu/auth/JSONObjectRet;)[Lcom/qiniu/utils/ICancel;

    move-result-object v0

    aput-object v0, v7, v8

    goto :goto_30
.end method

.method public onProcess(JJ)V
    .registers 12
    .param p1, "current"    # J
    .param p3, "total"    # J

    .prologue
    const/4 v2, 0x0

    .line 115
    iget-object v3, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$failure:[Z

    aget-boolean v3, v3, v2

    if-eqz v3, :cond_8

    .line 120
    :goto_7
    return-void

    .line 116
    :cond_8
    iget-object v3, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$uploaded:[J

    iget v4, p0, Lcom/qiniu/resumableio/ResumableIO$3;->mIdx:I

    aput-wide p1, v3, v4

    .line 117
    const-wide/16 p1, 0x0

    .line 118
    iget-object v3, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$uploaded:[J

    array-length v4, v3

    :goto_13
    if-ge v2, v4, :cond_1b

    aget-wide v0, v3, v2

    .local v0, "c":J
    add-long/2addr p1, v0

    add-int/lit8 v2, v2, 0x1

    goto :goto_13

    .line 119
    .end local v0    # "c":J
    :cond_1b
    iget-object v2, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$ret:Lcom/qiniu/auth/JSONObjectRet;

    iget-object v3, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$input:Lcom/qiniu/utils/InputStreamAt;

    invoke-virtual {v3}, Lcom/qiniu/utils/InputStreamAt;->length()J

    move-result-wide v4

    invoke-virtual {v2, p1, p2, v4, v5}, Lcom/qiniu/auth/JSONObjectRet;->onProcess(JJ)V

    goto :goto_7
.end method

.method public onSuccess(Lorg/json/JSONObject;)V
    .registers 5
    .param p1, "obj"    # Lorg/json/JSONObject;

    .prologue
    const/4 v2, 0x0

    .line 109
    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$failure:[Z

    aget-boolean v0, v0, v2

    if-nez v0, :cond_13

    iget-object v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$success:[I

    aget v1, v0, v2

    add-int/lit8 v1, v1, 0x1

    aput v1, v0, v2

    iget v0, p0, Lcom/qiniu/resumableio/ResumableIO$3;->val$blkCount:I

    if-eq v1, v0, :cond_14

    .line 111
    :cond_13
    :goto_13
    return-void

    .line 110
    :cond_14
    invoke-direct {p0}, Lcom/qiniu/resumableio/ResumableIO$3;->onAllSuccess()V

    goto :goto_13
.end method
